﻿using DryIoc;
using MyTodo.Extensions;
using MyTodo.Services;
using MyTodo.Services.Interfaces;
using MyTodo.Views;
using Prism.DryIoc;
using Prism.Ioc;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace MyTodo;

/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : PrismApplication
{

    protected override Window CreateShell()
    {
        return Container.Resolve<MainView>();
    }

    protected override void RegisterTypes(IContainerRegistry containerRegistry)
    {
        // 注册客户端服务
        containerRegistry.GetContainer()
            .Register<HttpRestClient>(made: Parameters.Of.Type<string>(serviceKey: "apiUrl"));
        containerRegistry.GetContainer()
            .RegisterInstance(@"http://localhost:5052", serviceKey: "apiUrl");

        containerRegistry.Register<IToDoService, ToDoService>();
        containerRegistry.Register<IMemoService, MemoService>();

        containerRegistry.RegisterForNavigation<IndexView>();
        containerRegistry.RegisterForNavigation<ToDoView>();
        containerRegistry.RegisterForNavigation<MemoView>();
        containerRegistry.RegisterForNavigation<SettingView>();
        containerRegistry.RegisterForNavigation<SkinView>();
        containerRegistry.RegisterForNavigation<AboutView>();
    }
}
